home *** CD-ROM | disk | FTP | other *** search
-
-
-
- HDF Vset FORTRAN Interface 6.1
-
-
-
-
- November 1990
-
-
-
-
-
-
-
- 6.1 NCSA HDF Vset
-
-
- National Center for Supercomputing Applications
-
-
- November 1990
-
-
-
-
-
- Chapter 6 HDF Vset FORTRAN Interface
-
-
-
- Chapter Overview
- Vgroup Level Calls
- Vdata Level Calls
- Vgroup FORTRAN Routines
- VFATCH
- VFDTCH
- VFGCLS
- VFGID
- VFGNAM
- VFGNXT
- VFINQ
- VFINSRT
- VFISVG
- VFISVS
- VFLONE
- VFSCLS
- VFSNAM
- Vdata FORTRAN Routines
- VSFATCH
- VSFDTCH
- VSFFDEF
- VSFEX
- VSFGCLS
- VSFGID
- VSFGNAM
- VSFINQ
- VSFLONE
- VSFREAD
- VSFSCLS
- VSFSEEK
- VSFSFLD
- VSFSINT
- VSFSNAM
- VSFWRIT
- FORTRAN Example
-
- Chapter Overview
-
- This chapter briefly discusses the vgroup and vdata routines
- available for use with FORTRAN. In the three succeeding tables
- below, use the function names in the first column in FORTRAN
- applications.
-
-
- Vgroup Level Calls
- Name C equivalent
-
- VFATCH (f, vsid, access) Vattach
- VFDTCH (vg) Vdetach
- VFGCLS (vg, vgclass) Vgetclass
- VFGID (f, vgid) Vgetid
- VFGNAM (vg, vgname) Vgetname
- VFGNXT (vg, id) Vgetnext
- VFINQ (vg, nentries, vgname) Vinquire
- VFINSRT (vg, vs) Vinsert
- VFISVG (vg, id) Visvg
- VFISVS (vg, id) Visvs
- VFLONE (f, idarray, asize) Vlone
- VFSCLS (vg, vgclass) Vsetclass
- VFSNAM (vg, vgname) Vsetname
-
-
- Vdata Level Calls
- Name C equivalent
-
- VSFATCH (f, vsid, access) VSattach
- VSFDTCH (vs) VSdetach
- VSFFDEF (vs, field, fieldtype, order) VSfdefine
- VSFEX (vs, fields) VSfexist
- VSFGCLS (vs, vsclass) VSgetclass
- VSFGID (f, vsid) VSgetid
- VSFGNAM (vs, vsname) VSgetname
- VSFINQ (vs, nelements, interlace,
- fields, vsize, vsname) VSinquire
- VFSLONE (f, idarray, asize) VSlone
- VSFREAD (vs, buf, nelements, interlace) VSread
- VSFSCLS (vs, vsclass) VSsetclass
- VSFSEEK (vs, element) VSseek
- VSFSFLD (vs, fields) VSsetfields
- VSFSINT (vs, interlace) VSsetinterlace
- VSFSNAM (vs, vsname) VSsetname
- VSFWRIT (vs, buf, nelements, interlace) VSwrite
-
-
-
- Vgroup FORTRAN Routines
-
- The following section briefly describes the vgroup routines
- available for use in FORTRAN. The FORTRAN routines appear
- in the right-hand column. Refer to Chapter 4, "Vgroup Routine
- Descriptions," for a more detailed discussion of these routines.
-
-
- VFATCH
- integer function VFATCH (f,vsid,access)
-
- integer f
- integer vsid
- character*1 access ('r' or 'w')
-
- Purpose: Attaches to a vgroup.
-
- Return value: Upon success, id of the vgroup (positive integer);
- otherwise, -1 .
-
-
- VFDTCH
- subroutine VFDTCH (vg)
-
- integer vg
-
- Purpose: Detaches a vgroup.
-
- Return value: None.
-
-
- VFGCLS
- subroutine VFGCLS (vg, vgclass)
-
- integer vg
- character*(*) vgclass
-
- Purpose: Returns the class name of the vgroup.
-
- Return value: None.
-
-
- VFGID
- integer function VFGID (f,vgid)
-
- integer f
- integer vgid
-
- Purpose: Returns the id of the next vgroup in the file.
-
- Return value: Upon success, id of next vgroup (0 or positive
- integer); otherwise, -1.
-
-
- VFGNAM
- subroutine VFGNAM (vg,vgname)
-
- integer vg
- character*(*) vgname
-
- Purpose: Returns the name of a vgroup.
-
- Return value: None.
-
- VFGNXT
- integer function VFGNXT (vg,id)
-
- integer vg
- integer id
-
- Purpose: Returns the id of the next entry from the vgroup.
-
- Return value: Upon success, id of next entry (0 or positive integer);
- otherwise, -1.
-
-
- VFINQ
- integer function VFINQ (vg,nentries,vgname)
-
- integer vg
- integer nentries
- character*(*) vgname
-
- Purpose: Performs a general inquiry on a vgroup.
-
- Return value: Upon success, 1; otherwise, -1.
-
-
- VFINSRT
- integer function VFINSRT (vg,v)
-
- integer vg
- integer v
-
- Purpose: Inserts a vgroup or vdata to the given vgroup.
-
- Return value: Upon success, the position in vgroup where entry is
- inserted (0 or positive integer); if error, -1.
-
-
- VFISVG
- integer function VFISVG (vg, id)
-
- integer vg
- integer id
-
- Purpose: Determines if an id in a vgroup refers to a vgroup.
-
- Return value: If it refers to a vgroup, 1; otherwise 0.
-
-
- VFISVS
- integer function VFISVS (vg, id)
-
- integer vg
- integer id
-
- Purpose: Determines if an id in a vgroup refers to a vdata.
-
- Return value: If it refers to a vdata, 1; otherwise 0.
-
-
- VFLONE
- integer function VFLONE (f, idarray, asize)
-
- integer f
- integer idarray(*)
- integer asize
-
- Purpose: Returns an array of reference numbers of vgroups that
- are not linked to any other vgroup.
-
- Return value: Upon success, the total number of such vgroups in the
- file; otherwise, -1.
-
-
- VFSCLS
- subroutine VFSCLS (vg, vgclass)
-
- integer vg
- character*(*) vgclass
-
- Purpose: Sets the class name for the vgroup.
-
- Return value: None.
-
-
- VFSNAM
- subroutine VFSNAM (vg,vgname)
-
- integer vg
- character*(*) vgname
-
- Purpose: Sets the name of the vgroup.
-
- Current limitation: The name string cannot contain blank
- spaces.
-
- Return value: None.
-
-
- Vdata FORTRAN Routines
-
- The following section briefly describes the vdata routines
- available for use in FORTRAN. Refer to Chapter 5, "Vdata
- Routine Descriptions," for a more detailed discussion of these
- routines.
-
-
- VSFATCH
- integer function VSFATCH (f,vsid,access)
-
- integer f
- integer vsid
- character*(1) access ('r' or 'w')
-
- Purpose: Attaches to a vdata.
-
- Return value: Upon success, id of vdata (positive integer);
- otherwise, -1 .
-
-
- VSFDTCH
- subroutine VSFDTCH (vs)
-
- integer vs
-
- Purpose: Detaches from a vdata.
-
- Return value: None.
-
-
- VSFFDEF
- integer function VSFFDEF (vs,field,fieldtype,
- order)
-
- integer vs
- character*(*) field
- integer fieldtype
- integer order
-
- Purpose: Defines a new field to be used in the vdata.
-
- Return value: Upon success, 1; otherwise, -1.
-
-
- VSFEX
- integer function VSFEX (vs,fields)
-
- integer vs
- character*(*) fields
-
- Purpose: Tests if given fields exist in the data.
-
- Return value: If the field(s) exist, 1; otherwise, -1
-
-
- VSFGCLS
- subroutine VSFGCLS (vs, vsclass)
-
- integer vs
- character*(*) vsclass
-
- Purpose: Returns the class name of the vdata.
-
- Return value: None.
-
-
- VSFGID
- integer function VSFGID (f,vsid)
-
- integer f
- integer vsid
-
- Purpose: Returns the id of the next vdata from the file.
-
- Return value: Upon success, id of vdata (0 or positive integer);
- otherwise, -1 if error or no more vdatas exist.
-
-
- VSFGNAM
- subroutine VSFGNAM (vs,vsname)
-
- integer vs
- character*(*) vsname
-
- Purpose: Returns the name of the vdata.
-
- Return value: None.
-
-
- VSFINQ
- integer function VSFINQ
- (vs,nelements,interlace,fields,vsize,vsname)
-
- integer vs
- integer nelements
- integer interlace
- integer vsize
- character*(*) fields
- character*(*) vsname
-
- Purpose: Performs a general inquiry on the vdata.
-
- Return value: If the vdata is ok, 1 is returned; if an error exists, -1
- is returned.
- VSFLONE
- integer function VSFLONE (f, idarray, asize)
-
- integer f
- integer idarray(*)
- integer asize
-
- Purpose: Returns an array of reference numbers of vdatas that are
- not linked to any other vgroup.
-
- Return value: Upon success, the total number of such vdatas in the
- file; otherwise, -1.
-
-
- VSFREAD
- integer function VSFREAD (vs,buf,nelements,
- interlace)
-
- integer vs
- character*(*) buf
- integer nelements
- integer interlace
-
- Purpose: Reads from a vdata.
-
- Return value: Upon success, the number of elements read (positive
- integer); otherwise, -1.
-
-
- VSFSCLS
- subroutine VSFSCLS (vs, vsclass)
-
- integer vs
- character*(*) vsclass
-
- Purpose: Sets the class name for the vdata.
-
- Return value: None.
-
-
- VSFSEEK
- integer function VSFSEEK (vs, element)
-
- integer vs
- integer element
-
- Purpose: Moves to an element's location in a vdata.
-
- Return value: Upon success, the element number (0 or positive
- integer); otherwise, -1
-
-
- VSFSFLD
- integer function VSFSFLD (vs, fields)
-
- integer vs
- character*(*) fields
-
- Purpose: Sets the fields in a vdata for reading or writing.
-
- Return value: Upon success, 1; otherwise, -1.
-
-
- VSFSINT
- subroutine VSFSINT (vs,interlace)
-
- integer vs
- integer interlace
-
- Purpose: Sets the file interlace for a vdata.
-
- Return value: Upon success, 1; otherwise, -1.
-
- VSFSNAM
- subroutine VSFSNAM (vs,vsname)
-
- integer vs
- character*(*) vsname
-
- Purpose: Sets the name of the vdata.
-
- Current limitation: vsname cannot contain blank spaces.
-
- Return value: None.
-
-
- VSFWRIT
- integer function VSFWRIT (vs, buf, nelements,
- interlace)
-
- integer vs
- character*(*) buf
- integer nelements
- integer interlace
-
- Purpose: Writes to a vdata.
-
- Return value: Upon success, the number of elements
- written(positive integer); otherwise, -1.
-
-
- FORTRAN Example
-
- Figure 6.1 shows an example FORTRAN program which stores a
- dataset as a vset of one vgroup and two vdatas.
-
- Figure 6.1 FORTRAN
- Example
-
- c =================================================================
- c
- c EG1.F
- c HDF VSET Sample Program
- c
- c Creates a vset of 1 vgroup and 2 vdatas into the file 'eg1.hdf'.
- c
- c compile and link
- c compile to get the object file 'eg1.o'
- c link 'eg1.o' with the libraries 'libvg.a' and 'libdf.a'
- c
- c What this program do: step by step.
- c
- c --- (A) ----
- c --- open HDF file, attach to new vgroup
- c --- name the vgroup 'my_fortran_vgroup'
- c
- c --- (B) ----
- c --- attach to new (1st) vdata, name it 'the_fortune_500_vdata'
- c --- write out 20 integers from buf as the predefined field 'IY'
- c --- tell VSFWRIT your data is fully-interlaced.
- c --- insert the vdata into the above vgroup
- c --- when done, detach the vdata.
- c
- c --- (C) ---
- c --- attach to new (2nd) vdata, name it 'the-famous-sevens'
- c --- define your own new field 'SIEBEN' type integer.
- c --- write out 70 integers from buf as the field 'SIEBEN'
- c --- tell VSFWRIT your data is fully-interlaced.
- c --- insert the vdata into the above vgroup
- c --- when done, detach the vdata.
- c
- c --- (D) ---
- c --- finally detach the vgroup and close the file
- c =================================================================
-
- program SAMPLE
-
- integer buf(100), sbuf(100), i,n
- integer f
-
- external DFOPEN, DFCLOSE
- external VSFATCH, VSFDTCH, VSFSFLD, VSFSNAM, VSFWRIT
- external VSFFDEF
- external VFATCH, VFDTCH, VFSNAM, VFINSRT
- integer DFOPEN
- integer VSFATCH, VSFSFLD, VSFWRIT, VSFFDEF
- integer VFATCH, VFINSRT
-
- integer vs, vg
-
- c some defined constants. see "vg.h"
- integer INTTYPE
- parameter (INTTYPE=2)
-
- Figure 6.1 FORTRAN Example (Continued)
-
- integer FINTRLACE
- parameter (FINTRLACE=0)
-
- integer FULLACC
- parameter (FULLACC=7)
-
- c ------ generate data -------
- do 111 i=1,100
- buf(i) = i+500
- sbuf(i) = i+7000
- 111 continue
-
-
- c ------ write to vset -------
-
- c --- (A) ----
- f = DFOPEN ('eg1.hdf', FULLACC, 0)
- vg = VFATCH (f, -1,'w')
- call VFSNAM(vg, 'my_fortran_group')
-
- c --- (B) ----
- vs = VSFATCH (f, -1,'w')
- call VSFSNAM(vs, 'the_fortune_500_vdata')
- n = VSFSFLD (vs, 'IY')
- n = VSFWRIT (vs, buf,20, FINTRLACE)
- n = VFINSRT (vg, vs)
- call VSFDTCH (vs)
-
- c --- (C) ---
- vs = VSFATCH (f, -1,'w')
- call VSFSNAM(vs, 'the-famous-sevens')
- n = VSFFDEF (vs, 'SIEBEN',INTTYPE,1)
- n = VSFSFLD (vs, 'SIEBEN')
- n = VSFWRIT (vs, sbuf,70, FINTRLACE)
- n = VFINSRT (vg, vs)
- call VSFDTCH (vs)
-
- c --- (D) ---
- call VFDTCH (vg)
- call DFCLOSE (f)
-
- end
-
-